home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / bloop.swf / scripts / DefineSprite_38_powerup / frame_1 / DoAction.as
Text File  |  2007-09-27  |  3KB  |  122 lines

  1. if(!speed)
  2. {
  3.    _root.setFrame(this);
  4.    gotoAndStop(random(_totalframes - 1) + 1);
  5.    while(_currentframe == _totalframes)
  6.    {
  7.       gotoAndStop(random(_totalframes - 1) + 1);
  8.    }
  9.    speed = _root.level + 1 + random(10) / 100;
  10.    if(this._currentframe == 1)
  11.    {
  12.       pname = "bomb";
  13.    }
  14.    else if(this._currentframe == 2)
  15.    {
  16.       pname = "1up";
  17.    }
  18.    else if(this._currentframe == 3)
  19.    {
  20.       pname = "big";
  21.    }
  22.    else if(this._currentframe == 4)
  23.    {
  24.       pname = "rapid fire";
  25.    }
  26. }
  27. onEnterFrame = function()
  28. {
  29.    if(_root.hud.levelmode._currentframe > 5)
  30.    {
  31.       removeMovieClip(this);
  32.    }
  33.    _root.checkFrame(this);
  34.    if(!float && !dead)
  35.    {
  36.       if(_X < 52)
  37.       {
  38.          _X++;
  39.       }
  40.       if(_X > Stage.width - 52)
  41.       {
  42.          _X--;
  43.       }
  44.       _Y = _Y + speed;
  45.       if(_Y > Stage.height)
  46.       {
  47.          removeMovieClip(this);
  48.       }
  49.       if(_root.cannon.hitTest(this))
  50.       {
  51.          dead = true;
  52.       }
  53.       if(!dead)
  54.       {
  55.          i = _root.depth - 50;
  56.          while(i < _root.depth + 10)
  57.          {
  58.             if(eval("_root.bullet" + i).hitTest(_X,_Y,true) && !eval("_root.bullet" + i).done)
  59.             {
  60.                this.float = true;
  61.                this.floatnum = i;
  62.                eval("_root.bullet" + i).done = true;
  63.             }
  64.             i++;
  65.          }
  66.       }
  67.    }
  68.    else
  69.    {
  70.       if(!makepower)
  71.       {
  72.          if(pname == "bomb")
  73.          {
  74.             _root.word.word = "Press space to use Bomb!";
  75.             _root.word.gotoAndPlay("fall");
  76.             _root.bombnum = _root.bombnum + 1;
  77.          }
  78.          else if(pname == "1up")
  79.          {
  80.             sound = new Sound();
  81.             sound.attachSound("mushroom2");
  82.             sound.start();
  83.             _root.word.word = "1 UP!";
  84.             _root.word.gotoAndPlay("fall");
  85.             _root.lives = _root.lives + 1;
  86.          }
  87.          else if(pname == "big")
  88.          {
  89.             sound = new Sound();
  90.             sound.attachSound("mushroom1");
  91.             sound.start();
  92.             _root.word.word = "Bubbles now big!";
  93.             _root.word.gotoAndPlay("fall");
  94.             _root.bigb = true;
  95.             _root.bigbcount = 10 * _root.fps;
  96.          }
  97.          else if(pname == "rapid fire")
  98.          {
  99.             _root.word.word = "Rapid Fire!";
  100.             _root.word.gotoAndPlay("fall");
  101.             _root.rapidcount = 10 * _root.fps;
  102.          }
  103.          makepower = true;
  104.       }
  105.       if(dead)
  106.       {
  107.          gotoAndStop(_totalframes);
  108.       }
  109.       _X = eval("_root.bullet" + floatnum)._x;
  110.       _Y = eval("_root.bullet" + floatnum)._y;
  111.       _alpha = 60;
  112.       if(_Y <= -50)
  113.       {
  114.          removeMovieClip(this);
  115.       }
  116.       if(_Y > Stage.height + 50)
  117.       {
  118.          removeMovieClip(this);
  119.       }
  120.    }
  121. };
  122.